package com.ruoyi.order.service.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.TbProductWholesaleMapper;
import com.ruoyi.order.domain.TbProductWholesale;
import com.ruoyi.order.service.ITbProductWholesaleService;

/**
 * 商品批发规格Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-19
 */
@Service
public class TbProductWholesaleServiceImpl implements ITbProductWholesaleService 
{
    @Autowired
    private TbProductWholesaleMapper tbProductWholesaleMapper;

    /**
     * 查询商品批发规格
     * 
     * @param id 商品批发规格主键
     * @return 商品批发规格
     */
    @Override
    public TbProductWholesale selectTbProductWholesaleById(Long id)
    {
        return tbProductWholesaleMapper.selectTbProductWholesaleById(id);
    }

    @Override
    public List<String> selectTypeCloumn(Long typeId) {
        List<String> strings = tbProductWholesaleMapper.selectCloumn(typeId);
        List<String> returnList = new ArrayList<>();
        for (String string : strings) {
            string=string+"+";
            returnList.add(string);
        }
        return returnList;
    }

    /**
     * 查询商品批发规格列表
     * 
     * @param tbProductWholesale 商品批发规格
     * @return 商品批发规格
     */
    @Override
    public List<TbProductWholesale> selectTbProductWholesaleList(TbProductWholesale tbProductWholesale)
    {
        return tbProductWholesaleMapper.selectTbProductWholesaleList(tbProductWholesale);
    }

    /**
     * 新增商品批发规格
     * 
     * @param tbProductWholesale 商品批发规格
     * @return 结果
     */
    @Override
    public int insertTbProductWholesale(TbProductWholesale tbProductWholesale)
    {
        tbProductWholesale.setCreateTime(DateUtils.getNowDate());
        return tbProductWholesaleMapper.insertTbProductWholesale(tbProductWholesale);
    }

    /**
     * 修改商品批发规格
     * 
     * @param tbProductWholesale 商品批发规格
     * @return 结果
     */
    @Override
    public int updateTbProductWholesale(TbProductWholesale tbProductWholesale)
    {
        return tbProductWholesaleMapper.updateTbProductWholesale(tbProductWholesale);
    }

    /**
     * 批量删除商品批发规格
     * 
     * @param ids 需要删除的商品批发规格主键
     * @return 结果
     */
    @Override
    public int deleteTbProductWholesaleByIds(Long[] ids)
    {
        return tbProductWholesaleMapper.deleteTbProductWholesaleByIds(ids);
    }

    /**
     * 删除商品批发规格信息
     * 
     * @param id 商品批发规格主键
     * @return 结果
     */
    @Override
    public int deleteTbProductWholesaleById(Long id)
    {
        return tbProductWholesaleMapper.deleteTbProductWholesaleById(id);
    }
}
